'use strict';
const db = uniCloud.database();

exports.main = async (event, context) => {
	try {
		const collection = db.collection('label');
		const res = await collection.get()
		console.log('云函数返回数据:', res.data)
		//返回数据给客户端
		return {
			code: 0,
			data: res.data,
			msg: '获取成功'
		}
	} catch (error) {
		console.error('云函数错误:', error)
		return {
			code: -1,
			data: [],
			msg: '获取失败'
		}
	}
};